Demystifying Computers

How They Really Work

Osher Lifelong Learning Institute
University of Illinois, Urbana-Champaign

Scott Badman, Instructor


The Central Processing Unit (CPU)

A computer is essentially an adding machine with a memory and the ability to press it's own buttons.

"Programmable Calculators" are actually computers.

Logical Building Blocks for a practical computer

Full adder can add one column of two binary numbers, including the carry in and the carry out.

8, 16, 32, or 64 of them can add two binary numbers.

Inverter flips the bits of a binary number using simple NOT gates

Needed for subtraction

Memory cell for one bit can be two NAND gates

Bus control can be done with one AND gate for each line on the bus

Address Decoder

Activates exactly the one output line corresponding to the binary number in the input

Opcode Decoder is similar to Address Decoder, but with a lot more complicated logic.

Building Blocks for a CPU

Memory (usually external to the CPU)

Simply a stack of bytes, with straightforward numbering from 0 to the whatever amount of memory is installed.

Read or Write, to a specific binary address number, as determined by the address decoder.

A two way Data Bus, usually called the "Front Side Bus" to carry data to and from memory.

A one way Address Bus from the CPU chip to the memory bus decoder.

Control Lines

Individual wires that turn busses on or off, and tell other logic circuits in the CPU what to do.

Each line has a specific purpose, used by one or more instructions.

Accumulator

Dedicated memory location on the CPU chip that holds data during calculations.

An 8, 16, 32, or 64 bit memory location on the CPU is called a "Register".

The Accumulator is analogous to the number in the display in a calculator.

The Arithmetic and Logic Unit

Does calculations using the Accumulator, putting the result back into the Accumulator.

The Program Colunter.

A special memory register that holds the address of the next instruction in memory.

Program Counter Incrementer

Logic that adds one to the Program Counter, and puts the result back into the Program Counter.

Instruction Registers

Holds a program instruction inside the CPU while it is being executed.

Instruction Decoder.

Logic that decodes the current instruction in the Instruction Registers and turns on the appropriate control lines to the rest of the CPU.

Fetch and Execute Circuitry.

Logic that gets the next program instruction from memory and stores it in the Instruction Registers, and then signals the Instruction Decoder to execute the instruction.

Controlled by the clock input to the CPU.

This circuitry is what actually makes the computer run.

The Nickel Counter Program in machine code

Almost incomprehensible to humans

What a program actually looks like in memory inside the computer.

Subtracts 5 from a specific number in memory, counting how many times it subtracts, and leaves the left over pennies at another location in memory.

The Nickel Counter Program in Assembly Language with addresses in hexadecimal.

Much more comprehensible to humans, but still somewhat archane.

One to One relationship between machine code instructions and Assembly Language instructions.

Shows different purposes of the bytes in machine code.

Opcodes - the instructions themselves

Opcode list for my conceptual 5-bit CPU

Moving data from memory to the Accumulator

Logic operations (not used in this program)

Arithmetic operations based on the Accumulator and a data value from memory

Remember that the Accumulator is analogous to the number in the display in a calculator.

Jumps, based on comparisons between the Accumulator and a data value from memory.

A few other special opcodes such as HALT

Simplified list of opcodes for Intel processors.

Addresses of variables used by opcodes.

Addresses of jump targets in jump opcodes.

Data in variables.

The Nickel Counter Program with Variable Names and Target Labels.

No more hex numbers.

To the computer, variable names in programs are just memory addresses where the data is stored.

JMP opcodes and target labels implement the important ability to jump to different parts of the program.

General trace of execution of the Nickel Counter Program.

Detailed trace of execution of the Nickel Counter Program.

IBM System 360 console from NASA Apollo Program IBM 360 control console from NASA Apollo Program

Switches for a 64-Bit Data Bus

Switches for a 24-Bit Address Bus

Also - notice the Hexadecimal to Binary Table right at the bottom.

What is Erika all about?

Current Intel Opcodes